Ext.define('WebOs.ViewFrame.tradition.view.TabManager', {

			tabPanel : null,

			constructor : function(config) {
				var me = this;
				Ext.apply(me, config);
			},

			getTabByServiceName : function(serviceName) {
				var me = this;
				var tabs = me.tabPanel.items;
				var result;
				tabs.each(function(item, index, length) {
							if (item.serviceName == serviceName) {
								result = item;
								return;
							}
						})
				return result;
			},

			closeAllTabs : function() {
				var me = this;
				var tabs = me.tabPanel.items;
				tabs.each(function(item, index, length) {
							item.destroy();
						})
			},

			closeOtherTabs : function(serviceName) {
				var me = this;
				var tabs = me.tabPanel.items;
				if (serviceName) {
					tabs.each(function(item, index, length) {
								if (item.serviceName != serviceName)
									item.destroy();
							})
				} else {
					tabs.each(function(item, index, length) {
								if (item != me.getActiveTab())
									item.destroy();
							})
				}
			},

			getActiveTab : function() {
				var me = this;
				return me.tabPanel.getActiveTab();
			}

		})